import { CoolController, BaseController, CoolUrlTag, TagTypes } from '@cool-midway/core';
import { Inject, Get } from '@midwayjs/decorator';
import { MenuService } from '../../service/menu';


/**
 * 轮播图 API
 */
@CoolUrlTag({ key: TagTypes.IGNORE_TOKEN, value: ['getMenu'], })
@CoolController()
export class MenuController extends BaseController {
    @Inject()
    menuService: MenuService;

    /**
     * 获取菜单
     */
    @Get('/getMenu')
    async getMenu() {
        const { success, message, data } = await this.menuService.getMenus();
        if (!success) return this.fail(data, message);
        return this.ok(data, message);
    }
}
